#pragma once
#include "SFC_Types.h"
#include "GraphLib.h"
/** \brief Base control class
 */


class SFC_Object
{
private:
	void SetDurty();
public:
	SFC_Object *Parent = nullptr;
	std::list<SFC_Object*> Children;
	SFC_Rect_X Size = {0, 0, 0, 0};
	SFC_Bool Visiable = true, Enable = true;

	bool Durty = false;
	Surface Cache = (Surface)0;

	SetEventHandle<bool> VisiableChanged;
	SetEventHandle<bool> EnableChanged;
	SetEventHandle<SFC_Rect_X> SizeChanged;
	SetEventHandle<int> SizeMemberChanged;

	virtual void LoadRes() = 0;
	virtual void Paint() = 0;
	virtual void EventRouter(SFC_Event &Event) = 0;
	SFC_Object();
	virtual ~SFC_Object();
	template<typename T>
	bool SetDurty(const T, T&);
};